/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JPanelFormularioGeneral.java
 *
 * Created on 21-nov-2011, 10:39:23
 */
package androidutal;

import com.toedter.calendar.JDateChooser;
import java.awt.BorderLayout;
import java.awt.Color;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

/**
 *
 * @author blackmoon
 */
public class JPanelBecaEstudio extends javax.swing.JPanel {
    private final JVentana ventana;
    File file;
    private String fechaInicio;
    private String fechaFin;
    private String resultado;
    private boolean isBorrador;
    private Date date;
    
    /** Creates new form JPanelFormularioGeneral */
    public JPanelBecaEstudio(JVentana ventana) {
        initComponents();
        this.file= null;
        this.ventana = ventana;
        this.isBorrador = false;
        this.date=new Date();
        this.jFechaIncio.setDate(date);
        this.jFechaFin.setDate(date);
        this.jResultados.setDate(date);
        
    }
    public boolean isBorrador() {
        return isBorrador;
    }
    public void setIsBorrador(boolean isBorrador) {
        this.isBorrador = isBorrador;
    }
    public File getFile() {
        return file;
    }

    public void setFile(File file) {
        this.file = file;
    }

    public JTextField getjAdjunto() {
        return jAdjunto;
    }

    public void setjAdjunto(JTextField jAdjunto) {
        this.jAdjunto = jAdjunto;
    }

    public JTextField getjDuracion() {
        return jDuracion;
    }

    public void setjDuracion(JTextField jDuracion) {
        this.jDuracion = jDuracion;
    }

    public JDateChooser getjFechaFin() {
        return jFechaFin;
    }

    public void setjFechaFin(String FechaFin) {
        this.jFechaFin.setDate(new Date(FechaFin));
    }

    public JDateChooser getjFechaIncio() {
        return jFechaIncio;
    }

    public void setjFechaIncio(String FechaIncio) {
        this.jFechaIncio.setDate(new Date(FechaIncio));
    }

    public JTextField getjInstituto() {
        return jInstituto;
    }

    public void setjInstituto(JTextField jInstituto) {
        this.jInstituto = jInstituto;
    }

    public String getFechaFin() {
        return fechaFin;
    }

    public void setFechaFin(String fechaFin) {
        this.fechaFin = fechaFin;
    }

    public String getFechaInicio() {
        return fechaInicio;
    }

    public void setFechaInicio(String fechaInicio) {
        this.fechaInicio = fechaInicio;
    }

    public String getResultado() {
        return resultado;
    }

    public void setResultado(String resultado) {
        this.resultado = resultado;
    }

    public JTextField getjNombre() {
        return jNombre;
    }

    public void setjNombre(JTextField jNombre) {
        this.jNombre = jNombre;
    }

    public JTextArea getjObjetivo() {
        return jObjetivo;
    }

    public void setjObjetivo(JTextArea jObjetivo) {
        this.jObjetivo = jObjetivo;
    }

    public JTextArea getjObservacion() {
        return jObservacion;
    }

    public void setjObservacion(JTextArea jObservacion) {
        this.jObservacion = jObservacion;
    }

    public JTextField getjPatrocinador() {
        return jPatrocinador;
    }

    public void setjPatrocinador(JTextField jPatrocinador) {
        this.jPatrocinador = jPatrocinador;
    }

    public JTextArea getjRequisito() {
        return jRequisito;
    }

    public void setjRequisito(JTextArea jRequisito) {
        this.jRequisito = jRequisito;
    }

    public JDateChooser getjResultados() {
        return jResultados;
    }

    public void setjResultados(String Resultados) {
        this.jResultados.setDate(new Date(Resultados));
    }

    public JTextField getJmonto() {
        return jmonto;
    }

    public void setJmonto(JTextField jmonto) {
        this.jmonto = jmonto;
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jNombre = new javax.swing.JTextField();
        jAdjunto = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        jRequisito = new javax.swing.JTextArea();
        jLabel4 = new javax.swing.JLabel();
        jButton4 = new javax.swing.JButton();
        jPatrocinador = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jInstituto = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jDuracion = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jObjetivo = new javax.swing.JTextArea();
        jLabel8 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jObservacion = new javax.swing.JTextArea();
        jLabel6 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jmonto = new javax.swing.JTextField();
        jPanel1 = new javax.swing.JPanel();
        jPublicar = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jFechaIncio = new com.toedter.calendar.JDateChooser();
        jFechaFin = new com.toedter.calendar.JDateChooser();
        jResultados = new com.toedter.calendar.JDateChooser();

        setBackground(java.awt.Color.black);
        setMinimumSize(new java.awt.Dimension(454, 386));
        setPreferredSize(new java.awt.Dimension(454, 386));

        jLabel1.setBackground(java.awt.Color.black);
        jLabel1.setForeground(java.awt.Color.white);
        jLabel1.setText("Nombre:");

        jLabel3.setBackground(java.awt.Color.black);
        jLabel3.setForeground(java.awt.Color.white);
        jLabel3.setText("Requisitos:");

        jNombre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jNombreActionPerformed(evt);
            }
        });

        jAdjunto.setEditable(false);

        jRequisito.setColumns(20);
        jRequisito.setLineWrap(true);
        jRequisito.setRows(5);
        jRequisito.setWrapStyleWord(true);
        jScrollPane1.setViewportView(jRequisito);

        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel4.setText("Beca estudio");

        jButton4.setBackground(java.awt.Color.white);
        jButton4.setText("Adjuntar");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jLabel9.setBackground(java.awt.Color.black);
        jLabel9.setForeground(java.awt.Color.white);
        jLabel9.setText("Patrocinador:");

        jLabel10.setBackground(java.awt.Color.black);
        jLabel10.setForeground(java.awt.Color.white);
        jLabel10.setText("Instituto:");

        jLabel11.setBackground(java.awt.Color.black);
        jLabel11.setForeground(java.awt.Color.white);
        jLabel11.setText("Monto:");

        jLabel5.setBackground(java.awt.Color.black);
        jLabel5.setForeground(java.awt.Color.white);
        jLabel5.setText("Objetivo:");

        jObjetivo.setColumns(20);
        jObjetivo.setLineWrap(true);
        jObjetivo.setRows(5);
        jObjetivo.setWrapStyleWord(true);
        jScrollPane2.setViewportView(jObjetivo);

        jLabel8.setBackground(java.awt.Color.black);
        jLabel8.setForeground(java.awt.Color.white);
        jLabel8.setText("Fecha post:");

        jLabel12.setBackground(java.awt.Color.black);
        jLabel12.setForeground(java.awt.Color.white);
        jLabel12.setText("Hasta:");

        jLabel13.setBackground(java.awt.Color.black);
        jLabel13.setForeground(java.awt.Color.white);
        jLabel13.setText("Resultados:");

        jObservacion.setColumns(20);
        jObservacion.setLineWrap(true);
        jObservacion.setRows(5);
        jObservacion.setWrapStyleWord(true);
        jScrollPane3.setViewportView(jObservacion);

        jLabel6.setBackground(java.awt.Color.black);
        jLabel6.setForeground(java.awt.Color.white);
        jLabel6.setText("Observaciones:");

        jLabel14.setBackground(java.awt.Color.black);
        jLabel14.setForeground(java.awt.Color.white);
        jLabel14.setText("Duracion:");

        jPanel1.setBackground(java.awt.Color.black);

        jPublicar.setBackground(java.awt.Color.white);
        jPublicar.setText("Publicar");
        jPublicar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jPublicarActionPerformed(evt);
            }
        });

        jButton2.setBackground(java.awt.Color.white);
        jButton2.setText("Borrador");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton6.setBackground(java.awt.Color.white);
        jButton6.setText("Cancelar");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addComponent(jButton2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 197, Short.MAX_VALUE)
                .addComponent(jPublicar)
                .addGap(28, 28, 28)
                .addComponent(jButton6))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jPublicar, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
                    .addComponent(jButton6)
                    .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 434, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3)
                            .addComponent(jLabel5)
                            .addComponent(jLabel6)
                            .addComponent(jLabel11)
                            .addComponent(jLabel8)
                            .addComponent(jLabel14)
                            .addComponent(jLabel10)
                            .addComponent(jLabel9)
                            .addComponent(jLabel1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 334, Short.MAX_VALUE)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 334, Short.MAX_VALUE)
                            .addComponent(jmonto, javax.swing.GroupLayout.DEFAULT_SIZE, 334, Short.MAX_VALUE)
                            .addComponent(jDuracion, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 334, Short.MAX_VALUE)
                            .addComponent(jNombre, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 334, Short.MAX_VALUE)
                            .addComponent(jPatrocinador, javax.swing.GroupLayout.DEFAULT_SIZE, 334, Short.MAX_VALUE)
                            .addComponent(jInstituto, javax.swing.GroupLayout.DEFAULT_SIZE, 334, Short.MAX_VALUE)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jAdjunto, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
                                    .addComponent(jFechaIncio, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel13)
                                    .addComponent(jLabel12))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jFechaFin, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jResultados, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE)))
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 334, Short.MAX_VALUE))
                        .addGap(20, 20, 20))
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(21, 21, 21)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jPatrocinador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jInstituto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jDuracion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel14))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel8)
                    .addComponent(jFechaFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(jFechaIncio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jAdjunto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButton4)
                        .addComponent(jLabel13))
                    .addComponent(jResultados, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jmonto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addGap(8, 8, 8)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(13, 13, 13)
                        .addComponent(jLabel6))
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE))
                .addGap(16, 16, 16)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jDuracion, jInstituto, jNombre, jPatrocinador});

    }// </editor-fold>//GEN-END:initComponents

private void jNombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNombreActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jNombreActionPerformed

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// TODO add your handling code here:
     final JFileChooser fc = new JFileChooser();
     
     int result= fc.showOpenDialog(this);
     fc.setVisible(true);
     if (result==JFileChooser.APPROVE_OPTION)
     {
        file = fc.getSelectedFile();
        this.jAdjunto.setText(file.getPath());
     }
     
     
}//GEN-LAST:event_jButton4ActionPerformed

private void jPublicarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPublicarActionPerformed
// TODO add your handling code here:
    if(jFechaIncio.getDate() != null && jFechaFin.getDate() != null && jResultados.getDate() != null && file!= null && !this.jNombre.getText().equals("") && 
      !jPatrocinador.getText().equals("") && !jInstituto.getText().equals("") && !jDuracion.getText().equals("")  && !jmonto.getText().equals("") && 
      !jObjetivo.getText().equals("") && !jRequisito.getText().equals("") && !jObservacion.getText().equals("")){
          if(this.isBorrador)
               this.ventana.getResumen().eliminarFila();
        fechaInicio = new SimpleDateFormat("MM/dd/yyyy").format(this.jFechaIncio.getDate());
        fechaFin = new SimpleDateFormat("MM/dd/yyyy").format(this.jFechaFin.getDate()); 
        resultado = new SimpleDateFormat("MM/dd/yyyy").format(this.jResultados.getDate()); 
        this.setIsBorrador(false);
        ventana.getBaseDeDatos().addBeca(this.jNombre.getText(), this.jPatrocinador.getText(), 
            this.jInstituto.getText(), this.jDuracion.getText(), fechaInicio,
            fechaFin, file, resultado, jmonto.getText(),
            jObjetivo.getText(), jRequisito.getText(), jObservacion.getText(),false,this.ventana.getConfiguracionSubeYBaja().generaUrl(file.getName()));
        Date date=new Date();
        ventana.getResumen().insertarInfo((String)this.jNombre.getText(),date.toString(),"No" );
        this.setVisible(false);
        ventana.add(ventana.getResumen(),BorderLayout.CENTER);
        ventana.getResumen().setVisible(true);
        ventana.save();
        ventana.saveToWS();
        ventana.subirFTP(file);
    }
    else{
        JOptionPane.showMessageDialog(this, "Rellene todos los campos es obligatorio");
    }
}//GEN-LAST:event_jPublicarActionPerformed

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
// TODO add your handling code here:
    if(this.isBorrador){
        this.jButton2ActionPerformed(evt);
        this.ventana.getResumen().eliminarFila();
        if(jFechaIncio.getDate() != null && jFechaFin.getDate() != null && jResultados.getDate() != null ){
            this.setVisible(false);
            ventana.add(ventana.getResumen(),BorderLayout.CENTER);
            ventana.getResumen().setVisible(true); 
        }
    }
    else{
            this.setVisible(false);
            ventana.add(ventana.getResumen(),BorderLayout.CENTER);
            ventana.getResumen().setVisible(true); 
    }
    this.desbloquear();
}//GEN-LAST:event_jButton6ActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
        fechaInicio = new SimpleDateFormat("MM/dd/yyyy").format(this.jFechaIncio.getDate()); 
        fechaFin = new SimpleDateFormat("MM/dd/yyyy").format(this.jFechaFin.getDate()); 
        resultado = new SimpleDateFormat("MM/dd/yyyy").format(this.jResultados.getDate());
        if(file!=null)
        ventana.getBaseDeDatos().addBeca(this.jNombre.getText(), this.jPatrocinador.getText(), 
                this.jInstituto.getText(), this.jDuracion.getText(), fechaInicio,
                fechaFin, file, resultado, jmonto.getText(),
                jObjetivo.getText(), jRequisito.getText(), jObservacion.getText(),true,this.ventana.getConfiguracionSubeYBaja().generaUrl(file.getName()));
        else
            ventana.getBaseDeDatos().addBeca(this.jNombre.getText(), this.jPatrocinador.getText(), 
                this.jInstituto.getText(), this.jDuracion.getText(), fechaInicio,
                fechaFin, file, resultado, jmonto.getText(),
                jObjetivo.getText(), jRequisito.getText(), jObservacion.getText(),true,"");
            
        ventana.getResumen().insertarInfo((String)this.jNombre.getText(),this.date.toString(),"Si" );
        this.setVisible(false);
        ventana.add(ventana.getResumen(),BorderLayout.CENTER);
        ventana.getResumen().setVisible(true);
        ventana.save();
}//GEN-LAST:event_jButton2ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField jAdjunto;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton6;
    private javax.swing.JTextField jDuracion;
    private com.toedter.calendar.JDateChooser jFechaFin;
    private com.toedter.calendar.JDateChooser jFechaIncio;
    private javax.swing.JTextField jInstituto;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JTextField jNombre;
    private javax.swing.JTextArea jObjetivo;
    private javax.swing.JTextArea jObservacion;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField jPatrocinador;
    private javax.swing.JButton jPublicar;
    private javax.swing.JTextArea jRequisito;
    private com.toedter.calendar.JDateChooser jResultados;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTextField jmonto;
    // End of variables declaration//GEN-END:variables

    public void bloquear(){
        this.getjNombre().setEditable(false);
        this.getJmonto().setEditable(false);
        this.getjAdjunto().setEditable(false);
        this.getjDuracion().setEditable(false);
        this.getjFechaFin().setEnabled(false);
        this.getjFechaIncio().setEnabled(false);
        this.getjInstituto().setEditable(false);
        this.getjObjetivo().setEditable(false);
        this.getjPatrocinador().setEditable(false);
        this.getjObservacion().setEditable(false);
        this.getjRequisito().setEditable(false);
        this.getjResultados().setEnabled(false);
        this.jButton2.setVisible(false);
        this.jButton4.setVisible(false);
        this.jPublicar.setVisible(false);
    }

    public void desbloquear(){
        this.getjNombre().setEditable(true);
        this.getJmonto().setEditable(true);
        this.getjAdjunto().setEditable(true);
        this.getjDuracion().setEditable(true);
        this.getjFechaFin().setEnabled(true);
        this.getjFechaIncio().setEnabled(true);
        this.getjInstituto().setEditable(true);
        this.getjObjetivo().setEditable(true);
        this.getjPatrocinador().setEditable(true);
        this.getjObservacion().setEditable(true);
        this.getjRequisito().setEditable(true);
        this.getjResultados().setEnabled(true);
        this.jButton2.setVisible(true);
        this.jButton4.setVisible(true);
        this.jPublicar.setVisible(true);
    }
}
